package com.teamwhole.core.persistence;

import java.util.List;
import java.util.Map;

import jersey.repackaged.com.google.common.collect.Lists;
import jersey.repackaged.com.google.common.collect.Maps;

public abstract class TreeEntity<T> extends BaseEntity<T> {

	private static final long serialVersionUID = 1L;
	
	protected Boolean checked;			// 表示该节点是否被选中。
	protected String state = "closed";	// 节点状态，'open' 或 'closed'，默认：'open'。如果为'closed'的时候，将不自动展开该节点
	protected Map<String, Object> attributes = Maps.newHashMap();	// 被添加到节点的自定义属性。
	protected List<T> children = Lists.newArrayList();				// 一个节点数组声明了若干节点
	
	public TreeEntity() {
        this.delFlag = DEL_FLAG_NORMAL;
    }

    public TreeEntity(String id) {
        this();
        this.id = id;
    }
	
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public Boolean getChecked() {
		return checked;
	}

	public void setChecked(Boolean checked) {
		this.checked = checked;
	}

	public List<T> getChildren() {
		return children;
	}

	public void setChildren(List<T> children) {
		this.children = children;
	}

	public Map<String, Object> getAttributes() {
		return attributes;
	}

	public void setAttributes(Map<String, Object> attributes) {
		this.attributes = attributes;
	}
}
